﻿<Controls:SinacorWindow x:Class="Sinacor.UI.Bovespa.Operador.View.SmartClient.CadastroOperadores" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Edit="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Edit;assembly=Sinacor.Infra.UI.Controls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    
    WindowStartupLocation="CenterScreen" 
    WindowState="Maximized"                  
                        
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    ModuleId="ORD"
    ModulePlus="true"
    Title="{DynamicResource Bovespa.Operador.Label.CadastroOperadores}" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d">

    <Controls:SinacorExpanderContainer x:Name="ExpContainer01">
        <Controls:SinacorExpanderContainer.RowDefinitions>
            <RowDefinition Height="32*" MinHeight="100"/>
            <RowDefinition Height="1*" />
            <RowDefinition Height="33*" MinHeight="100"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="33*" MinHeight="100"/>
        </Controls:SinacorExpanderContainer.RowDefinitions>
        <Controls:SinacorExpanderContainer.ColumnDefinitions>
            <ColumnDefinition Width="50*" MinWidth="100"/>
            <ColumnDefinition Width="50*" MinWidth="100"/>
        </Controls:SinacorExpanderContainer.ColumnDefinitions>
        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Operador.Label.Usuarios}" Grid.Row="0" x:Name="ExpUsuarios" Grid.ColumnSpan="2" IsExpanded="True" >
            <Grid>
                <Controls:SinacorDataGrid x:Name="DtgUsuarios"                                          
                                          VerticalAlignment="Stretch"
                                          HorizontalAlignment="Stretch"                                          
                                          Margin="0,0,0,25"
                                          ItemsSource="{Binding Path=ListaUsuarios}">
                    <Controls:SinacorDataGrid.ContextMenuTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Controls:SinacorContextMenuItem x:Name="MnuIncluirOperador" Header="{DynamicResource Bovespa.Operador.Label.IncluirOperador}" Click="BtnIncluirOperador_Click" Loaded="MnuIncluirOperador_Loaded" />
                            </StackPanel>
                        </DataTemplate>
                    </Controls:SinacorDataGrid.ContextMenuTemplate>
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="NomeUsuario"
                                         Title="Bovespa.Operador.Label.Nome"
                                         DisplayMemberPath="Nome"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
                                         Width="225"										
										 />

                        <Controls:Column Name="LoginUsuario"
                                         Title="Bovespa.Operador.Label.Login"
                                         DisplayMemberPath="Login"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
										 Width="130"										
										 />

                        <Controls:Column Name="CodigoUsuario"
                                         Title="Bovespa.Operador.Label.Codigo"
                                         DisplayMemberPath="Codigo"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Right"
										 AutoAdjustWidthToContent="True"
										 />
                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
                <Controls:SinacorButton x:Name="BtnIncluirOperador"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.IncluirOperador}"
                                        Width="145"
                                        Margin="0,0,0,0"/>
            </Grid>
        </Controls:SinacorExpander>
        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Operador.Label.Operadores}" Grid.Row="2" x:Name="ExpOperadores" Grid.ColumnSpan="2" IsExpanded="True">
            <Grid>
                <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" Stroke="{DynamicResource BrushGridRowBusiness06}" HorizontalAlignment="Left" Margin="8,0,0,2" VerticalAlignment="Bottom" Width="10" Height="10"/>
                <Controls:SinacorTextBlock HorizontalAlignment="Left" Margin="24,0,0,0" VerticalAlignment="Bottom" Width="180" Text="{DynamicResource Bovespa.Operador.Label.Bloqueado}" Padding="0,7,0,0" Foreground="{DynamicResource BrushGridRowBusiness06}"/>
                <Controls:SinacorDataGrid x:Name="DtgOperadores"
                                          Margin="0,0,0,25"
                                          ItemsSource="{Binding Path=ListaOperadores}"                                          
                                          AllowDelete="False"
                                          ApplyingStyle="DtgOperadores_ApplyingStyle">
                    <Controls:SinacorDataGrid.ContextMenuTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Controls:SinacorContextMenuItem x:Name="MnuExcluirOperador" Header="{DynamicResource Bovespa.Operador.Label.Excluir}" Click="BtnExcluirOperador_Click" Loaded="MnuExcluirOperador_Loaded"/>
                            </StackPanel>
                        </DataTemplate>
                    </Controls:SinacorDataGrid.ContextMenuTemplate>
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="NomeOperadores"
                                         Title="Bovespa.Operador.Label.Nome"
                                         DisplayMemberPath="NomeOperador"                                         
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
										 Width="225" />

                        <Controls:Column Name="LoginOperadores"
                                         Title="Bovespa.Operador.Label.Login"
                                         DisplayMemberPath="LoginOperador"                                         
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
										 Width="130" />

                        <Controls:Column Name="CodigoOperadores"
                                         Title="Bovespa.Operador.Label.Codigo"
                                         DisplayMemberPath="CodigoOperador"                                         
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Right" />

                        <Controls:Column Name="PontaMesaOperadores"
                                         Title="Bovespa.Operador.Label.PontaMesa"
                                         DisplayMemberPath="IndicadorPontaMesa"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="True" 
                                         HorizontalCellAlignment="Center">

                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorCheckBox x:Name="ChkIndicadorPontaMesa" 
                                                              IsChecked="{Binding Path=IndicadorPontaMesa}"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>

                        <Controls:Column Name="HomeBrokerOperadores"
                                         Title="Bovespa.Operador.Label.HomeBroker"
                                         DisplayMemberPath="IndicadorOperadorHomeBroker"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="True" 
                                         HorizontalCellAlignment="Center">

                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorCheckBox x:Name="ChkIndicadorOperadorHomeBroker" 
                                                              IsChecked="{Binding Path=IndicadorOperadorHomeBroker}"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>

                        <Controls:Column Name="DesprezaOfertaOperadores"
                                         Title="Bovespa.Operador.Label.DesprezaOferta"
                                         DisplayMemberPath="IndicadorDesprezaOperadorSinalOfertasMegaBolsa"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="True" 
                                         HorizontalCellAlignment="Center">

                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorCheckBox x:Name="ChkIndicadorDesprezaOperadorSinalOfertasMegaBolsa" 
                                                              IsChecked="{Binding Path=IndicadorDesprezaOperadorSinalOfertasMegaBolsa}"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>

                        <Controls:Column Name="CodigoMegaOperadores"
                                         Title="Bovespa.Operador.Label.CodigoMega"
                                         DisplayMemberPath="CodigoOperadorMegaBolsa"                                         
                                         AllowInsert="False"
                                         AllowUpdate="True" 
                                         HorizontalCellAlignment="Right">

                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox x:Name="TxtCodigoOperadorMegaBolsa" 
                                                                  Value="{Binding Path=CodigoOperadorMegaBolsa}"
                                                                  Integers="6"
                                                                  AcceptsNegative="False"
                                                                  IsFormated="False"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>

                        <Controls:Column Name="CodigoRendaFixa"
                                         Title="Bovespa.Operador.Label.RendaFixa"
                                         DisplayMemberPath="CodigoOperadorRendaFixa"                                         
                                         AllowInsert="False"
                                         AllowUpdate="True"
                                         HorizontalCellAlignment="Right">

                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorFilteredTextBox x:Name="TxtCodigoOperadorRendaFixa" 
                                                                     Text="{Binding Path=CodigoOperadorRendaFixa}"
                                                                     MaxLength="2"
                                                                     FilterExpression="^[a-zA-Z0-9]{0,5}$"
                                                                     HorizontalAlignment="Right"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>

                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
                <Controls:SinacorButton x:Name="BtnExcluirOperador"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.Excluir}"
                                        Margin="0,0,0,0"
                                        Width="65"/>
            </Grid>
        </Controls:SinacorExpander>
        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Operador.Label.Subordinados}" Grid.Row="4" x:Name="ExpSubordinados" IsExpanded="True" AllowExpand="False">
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
                <Ellipse Fill="{DynamicResource BrushGridRowBusiness01}" Stroke="{DynamicResource BrushGridRowBusiness13}" HorizontalAlignment="Left" Margin="8,0,0,2" VerticalAlignment="Bottom" Width="10" Height="10"/>
                <Controls:SinacorTextBlock HorizontalAlignment="Left" Margin="24,0,0,0" VerticalAlignment="Bottom" Width="180" Text="{DynamicResource Bovespa.Operador.Label.Subordinados}" Padding="0,7,0,0" Foreground="{DynamicResource BrushGridRowBusiness01}"/>
                <Controls:SinacorDataGrid MinHeight="150"
                                          x:Name="DtgSubordinados"
                                          Margin="0,0,0,25"
                                          ItemsSource="{Binding Path=ListaSubordinados}">
                    <Controls:SinacorDataGrid.ContextMenuTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Controls:SinacorContextMenuItem x:Name="MnuDefinirSubordinado" Header="{DynamicResource Bovespa.Operador.Label.DefinirSubordinado}" Click="BtnDefinirSubordinado_Click" Loaded="MnuDefinirSubordinado_Loaded"/>
                                <Controls:SinacorContextMenuItem x:Name="MnuExcluirSubordinado" Header="{DynamicResource Bovespa.Operador.Label.Excluir}" Click="BtnExcluirSubordinado_Click" Loaded="MnuExcluirSubordinado_Loaded"/>
                            </StackPanel>
                        </DataTemplate>
                    </Controls:SinacorDataGrid.ContextMenuTemplate>
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="NomeSubordinados"
                                         Title="Bovespa.Operador.Label.Nome"
                                         DisplayMemberPath="NomeOperador"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
										 Width="225" />

                        <Controls:Column Name="LoginSubordinados"
                                         Title="Bovespa.Operador.Label.Login"
                                         DisplayMemberPath="LoginOperador"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Left"
										 AutoAdjustWidthToContent="False"
										 Width="130" />

                        <Controls:Column Name="CodigoSubordinados"
                                         Title="Bovespa.Operador.Label.Codigo"
                                         DisplayMemberPath="CodigoOperador"
                                         IsRequired="True"
                                         AllowInsert="False"
                                         AllowUpdate="False" 
                                         HorizontalCellAlignment="Right" />
                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
                <Controls:SinacorButton x:Name="BtnDefinirSubordinado"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.DefinirSubordinado}"
                                        Width="155"
                                        Margin="0,0,72,0"/>
                <Controls:SinacorButton x:Name="BtnExcluirSubordinado"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.Excluir}"
                                        Width="65"/>
            </Grid>
        </Controls:SinacorExpander>
        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Operador.Label.Origem}" x:Name="ExpOrigem" Grid.Row="4" Grid.ColumnSpan="1" Grid.Column="1" Margin="4,0,0,0" IsExpanded="True" AllowExpand="False">
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
                <Controls:SinacorDataGrid x:Name="DtgOrigem"
                                          MinHeight="150"
                                          Margin="0,0,0,25"
                                          ItemsSource="{Binding Path=ListaOrigem}"
                                          AllowDelete="False">
                    <Controls:SinacorDataGrid.ContextMenuTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Controls:SinacorContextMenuItem x:Name="MnuExcluirOrigem" Header="{DynamicResource Bovespa.Operador.Label.Excluir}" Click="BtnExcluirOrigem_Click" Loaded="MnuExcluirOrigem_Loaded"/>
                            </StackPanel>
                        </DataTemplate>
                    </Controls:SinacorDataGrid.ContextMenuTemplate>
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="NomeCorretora"
        					             Title="Bovespa.Operador.Label.Corretora"
                                         DisplayMemberPath="Corretora"                                                 					             
        					             AllowInsert="True"
        					             AllowUpdate="True"
        					             HorizontalCellAlignment="Left"
                                         CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorFilteredTextBox x:Name="TxtCorretora" 
                                                                     Text="{Binding Path=Corretora}"
                                                                     MaxLength="5"
                                                                     FilterExpression="^[a-zA-Z0-9]{0,5}$"
                                                                     RequiredErrorMessage="Bovespa.Operador.ExceptionMessage.CodigoCorretoraInvalido"/>

                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>

                        </Controls:Column>

                        <Controls:Column Name="NomeOperador"
        					             Title="Bovespa.Operador.Label.Operador"
                                         DisplayMemberPath="OperadorOrigem"        					             
        					             AllowInsert="True"
        					             AllowUpdate="True" 
        					             HorizontalCellAlignment="Left"
                                         CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorFilteredTextBox x:Name="TxtOperador" 
                                                                     Text="{Binding Path=OperadorOrigem}"
                                                                     MaxLength="5"
                                                                     FilterExpression="^[a-zA-Z0-9]{0,5}$"
                                                                     RequiredErrorMessage="Bovespa.Operador.ExceptionMessage.CodigoOperadorInvalido"/>
                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>

                        </Controls:Column>


                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
                <Controls:SinacorButton x:Name="BtnNovoOrigem"                                        
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.Novo}"
                                        Width="65"
                                        Margin="0,0,144,0"/>
                <Controls:SinacorButton x:Name="BtnExcluirOrigem"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.Excluir}"
                                        Width="65"
                                        Margin="0,0,72,0"/>
                <Controls:SinacorButton x:Name="BtnSalvarOrigem"
                                        IsEnabled="False"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Content="{DynamicResource Bovespa.Operador.Label.Salvar}"
                                        Width="65"/>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>